package cms.api;

import cms.api.vo.OrganizationSaveVo;
import cms.model.Organization;
import goods.model.SalesPriceRate;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Created by DixonLim on 2016/12/1.
 */
public interface OrganizationApi {

    public String toString();

    /**
     * 保存organization
     * @param organization
     * @return
     */
    public Organization saveOrganization(Organization organization);

    /**
     * 根据id删除organization
     * @param id
     */
    public void deleteOrganization(String id);

    /**
     * 根据id查询organization
     * @param id
     * @return
     */
    public Organization findOrganizationById(String id);

    /**
     * 根据name查询organization
     * @param name
     * @return
     */
    public List<Organization> findOrganizationByOrgName(String name);

    /**
     * 根据name查询organization
     * @param name
     * @return
     */
    public List<Organization> findOrganizationByOrgNameAndIsDelete(String name);

    /**
     * 根据saveVo保存或修改organization
     * @param saveVo
     * @param depositPersonMap  充值操作人信息
     * @return
     */
    public Organization saveOrganizationDetail(OrganizationSaveVo saveVo ,Map<String,String> depositPersonMap);

    /**
     * 根据organizationId，scoreType，score，remark添加rganizationCredits
     * @param organizationId
     * @param scoreType
     * @param score
     * @param remark
     * @return
     */
    public Organization addOrganizationCredits(String organizationId,String scoreType,Integer score,String remark);


    /**
     * 根据name查询organization
     * @param orgName
     * @param pageable
     * @return
     */
    public Page<Organization> findOrganizationByOrgName(String orgName,Pageable pageable);


    /**
     * 获取organization未删除的全部信息,并返回list集合
     * @return
     */
    public List<Organization> findOrganizationAll();

    public Map listToMap() ;

    Organization findOrganizationByOrgCode(String organizationCode);

    /**
     * 将SalesPriceRateList中的organizationId替换为organizationName用于页面显示
     * @return
     */
    public List<SalesPriceRate> getOrgNameList(Page<SalesPriceRate> salesPriceRates);

    /**
     * 账号额度控制
     * @param organizationId  机构id
     * @param totalMoney  扣除金额
     * @param operationType  操作类型  beforehand ： 预先  sure ：确认扣除   cancel 取消
     * @param userName 用户名，不一定有
     * @param memberId 会员id，不一定有
     * @param orderNo 订单号，一定有
     * @return
     */
    public Map organizationAccountCtrl(String organizationId, BigDecimal totalMoney,String operationType,String userName,String memberId,String orderNo);
}
